#!/bin/bash

date

if [ $# != 3 ];then
echo "USAGE $0 <dir_path>  <expire_day>  <file_ext>"
echo "Sample:  $0 /data1/log 1 log"
exit 1;
fi
 
DIR_PATH=$1
EXP_DAY=$2
FILE_EXT=$3
 
files=`find ${DIR_PATH} -type f -mtime +$2 | grep $FILE_EXT`
echo "$files"
for fli in $files
do
    FILE_NAME=${fli}
    echo "delete file:${FILE_NAME}"
    rm $FILE_NAME
done

date
